package rentadomus
class Place {
    
    Person idPerson
    String titlePlace
    String address
    Date date
    int mainImage
    String neighborhood
    int strata
    double rentPrice
    float area
    String description
    // servicios que ofrece el lugar
    Boolean energy
    Boolean water
    Boolean gas
    Boolean wifi
    Boolean phone
    Boolean cableTv
    static hasMany = [img: Images]
     static mapping ={
        version false
        img cascade: "all-delete-orphan"
        idPerson column: 'id_Person'
        rentPrice column: 'rent_price'
    }
    
    static constraints = {
        
        date nullable: true
        titlePlace blank: false
        mainImage blank: true
        strata inList:1..6
        address blank:false
        rentPrice blank:false, min: 1000.0D
        area blank:false, min: 0.0F, max: 3000.0F
        neighborhood blank:false
        description blank:false
        
    }  
    
    public String toString(){
        "$titlePlace"
    }
}